package bigraph.model;

import java.util.Iterator;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.swt.graphics.Color;
import org.eclipse.draw2d.geometry.*;


public class Site extends Node {

	public static final String PROPERTY_COLOR = "SiteColor";
	private Color background;
	
	public Site() {
		super();
		this.background = ColorConstants.white;
	}
    
	
	public void setColor(Color color) {
    	Color oldColor = background;
    	this.background = color;
    	getListeners().firePropertyChange(PROPERTY_COLOR, oldColor, color);
    }
    
    public Color getColor() {
    	return background;
    }
    
    @Override
    public Object clone() throws CloneNotSupportedException {
         Site st = new Site();
         st.setColor(this.background);
         st.setName(this.getName());
         st.setParent(this.getParent());
         st.setLayout(new Rectangle(
                     getLayout().x + 10, getLayout().y + 10,
                     getLayout().width, getLayout().height));
       /*  Iterator<Node> it = this.getChildrenArray().iterator();
           while (it.hasNext()) {
               Node node = it.next();
               if (node instanceof Employe) {
                     Employe child = (Employe)node;
                     Node clone = (Node)child.clone();
                     srv.addChild(clone);
                     clone.setLayout(child.getLayout());
               }
         } */
         return st;
    }

    


	
}
